package huawei

import (
	"dta-apk/global"
	"encoding/json"
	"fmt"
	"strings"
)

// 认证信息
func getAuthorization() string {
	auth := strings.ReplaceAll(authorization_format, "${access_token}", getAccessToken())
	return auth
}

// 客户端请求头
func getClientHeader() map[string]string {
	headerMap := map[string]string{
		"client_id":     global.Config.App.Huawei.ClientId,
		"Authorization": getAuthorization(),
		"Content-Type":  "application/json",
		"Accept":        "application/json",
	}
	return headerMap
}

// 结果处理
func handleResult(apiResult string, result any) {
	error := json.Unmarshal([]byte(apiResult), result)
	if error != nil {
		fmt.Println(error)
	}
}
